﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using H2.Streams;

namespace Mystery.SCNR.Scripts
{
    public class ScriptObject
    {
        public const int Offset = 72;
        public const int ChunkSize = 36;

        public string Name;

        public ObjectTypes Type;

        public int PlacementIndex;

        public static ScriptObject[] Read(MapStream map, int scnrOffset)
        {
            ScriptObject[] scriptObjects = new ScriptObject[map.ReadReflexiveAt(scnrOffset + Offset)];

            for (int i = 0; i < scriptObjects.Length; i++)
            {
                ScriptObject so = new ScriptObject();
                scriptObjects[i] = so;

                so.Name = map.ReadString(32, false);
                so.Type = (ObjectTypes)map.ReadInt16();
                so.PlacementIndex = map.ReadInt16();
            }

            return scriptObjects;
        }
    }
}
